Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: QuickTime Components

Previous | Overview | Contents | Next |

Implementing the Required Component Functions

Listing 1 supplies the component dispatchers for the sequence grabber panel component together with the required functions for open, close, can do, and version.

Listing 1 Implementing the required functions

#define sgcPictShowTicksType 'TICK'
typedef struct {
    ComponentInstance           self;
    ControlHandle               ch;
} PictPanelGlobalsRecord, *PictPanelGlobals;
/* only for PICT channels */
pascal ComponentResult SGSetShowTickCount (SGChannel c,
                    Boolean show) = {0x2f3c,2,0x100,0x7000,0xA82A};
pascal ComponentResult SGGetShowTickCount (SGChannel c,
                    Boolean *show) = {0x2f3c,4,0x101,0x7000,0xA82A};
pascal ComponentResult PictPanelDispatcher
                    (ComponentParameters *params, Handle storage)
{
    OSErr err = badComponentSelector;
    ComponentFunction componentProc = 0;
    switch (params->what) {

        case kComponentOpenSelect:
            componentProc = PictPanelOpen; break;
        case kComponentCloseSelect:
            componentProc = PictPanelClose; break;
        case kComponentCanDoSelect:
            componentProc = PictPanelCanDo; break;
        case kComponentVersionSelect:
            componentProc = PictPanelVersion; break;
        case kSGCPanelGetDitlSelect:
            componentProc = PictPanelPanelGetDitl; break;
        case kSGCPanelInstallSelect:
            componentProc = PictPanelPanelInstall; break;
        case kSGCPanelItemSelect:
            componentProc = PictPanelPanelItem; break;
        case kSGCPanelRemoveSelect:
            componentProc = PictPanelPanelRemove; break;

        case kSGCPanelGetSettingsSelect:
            componentProc = PictPanelPanelGetSettings; break;
        case kSGCPanelSetSettingsSelect:
            componentProc = PictPanelPanelSetSettings; break;
    }

    if (componentProc)
        err = CallComponentFunctionWithStorage (storage, params,
                                                             componentProc);

    return err;
}

pascal ComponentResult PictPanelCanDo (PictPanelGlobals store,
                                                     short ftnNumber)
{

    switch (ftnNumber) {
        case kComponentOpenSelect:
        case kComponentCloseSelect:
        case kComponentCanDoSelect:
        case kComponentVersionSelect:
        case kSGCPanelGetDitlSelect:
        case kSGCPanelInstallSelect:
        case kSGCPanelItemSelect:
        case kSGCPanelRemoveSelect:
        case kSGCPanelGetSettingsSelect:
        case kSGCPanelSetSettingsSelect:
            return true;
        default:
            return false;
    }
}

pascal ComponentResult PictPanelVersion (PictPanelGlobals store)
{
    return 0x00020001;
}
pascal ComponentResult PictPanelOpen (PictPanelGlobals store,
                                                     ComponentInstance self)
{
    OSErr err;
    /* allocate global variables */
    store = (PictPanelGlobals) NewPtrClear
                (sizeof(PictPanelGlobalsRecord));
    if (err = MemError()) goto bail;
    SetComponentInstanceStorage (self, (Handle)store);
    /* remember the component instance identification number */
    store->self = self;

bail:
    return err;
}

pascal ComponentResult PictPanelClose (PictPanelGlobals store,
                                                    ComponentInstance self)
{
    if (store) DisposePtr ((Ptr)store);
    return noErr;
}

© 1999 Apple Computer, Inc.

Previous | Overview | Contents | Next